﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Modules.peddler {
    import Engine.Events.*;
    import Classes.*;
    import Classes.effects.*;
    import Engine.*;

    public class PeddlerQuitAnimationEffect extends AnimationEffect {

        public function PeddlerQuitAnimationEffect(_arg1:MapResource, _arg2:String, _arg3:Boolean=false, _arg4:Boolean=false, _arg5:Boolean=false){
            super(_arg1, _arg2, _arg3, _arg4, _arg5);
        }
        override protected function onAnimationEnded():void{
            if ((m_mapResource is Peddler)){
                (m_mapResource as Peddler).disablePeddler();
            };
        }
        public function preLoadAnimation():void{
            this.loadAnimationEffect();
        }
        override protected function loadAnimationEffect():void{
            var _local2:XML;
            var _local3:String;
            var _local4:XML;
            var _local5:XML;
            if (((!((m_mapResource == null))) && ((m_mapResource.getItem() == null)))){
                m_isActive = false;
                return;
            };
            var _local1:Boolean = ((((m_mapResource.content) && (m_mapResource.getItemImage()))) && (!(m_mapResource.isCurrentImageLoading())));
            if (((_local1) && (!(m_itemImage)))){
                _local2 = Global.gameSettings.getEffectByName(m_effectName);
                _local3 = "SW";
                switch (m_mapResource.getDirection()){
                    case Constants.DIRECTION_SW:
                        _local3 = "SW";
                        break;
                    case Constants.DIRECTION_SE:
                        _local3 = "SE";
                        break;
                    case Constants.DIRECTION_NE:
                        _local3 = "NE";
                        break;
                    case Constants.DIRECTION_NW:
                        _local3 = "NW";
                        break;
                };
                _local4 = _local2[0];
                for each (_local5 in _local2.children()) {
                    if (_local5.@direction == _local3){
                        _local4 = _local5;
                        break;
                    };
                };
                m_originalFPS = ((_local4.@fps) || (1));
                m_itemImage = new ItemImage(_local4);
                m_itemImage.addEventListener(LoaderEvent.LOADED, this.onItemImageLoaded, false, 0, true);
                m_itemImage.load();
            };
        }
        override protected function onItemImageLoaded(_arg1:LoaderEvent):void{
            var _local2:ItemImageInstance;
            if (_arg1.target == m_itemImage){
                _local2 = m_itemImage.getInstance();
                if (!_local2){
                    return;
                };
                m_itemImage.removeEventListener(LoaderEvent.LOADED, this.onItemImageLoaded);
            };
        }

    }
}//package Modules.peddler 
